import api from './base'
import { parseUrlParams } from '@/utils/tools.js'
let qs = parseUrlParams(window.location.href)
const { operator } = qs

// 获取分组信息列表接口
export function fetchGroupData(data) {
  return api.post('/assign/packetInformation', { ...data })
}
export function saveGroupData(data) {
  return api({
    url: '/assign/packetInformationSave',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 组内人员明细信息
export function fetchPersonData(data) {
  return api.post('/assign/operatorGroupInfo', { ...data })
}
export function preserSave(data) {
  return api({
    url: '/assign/operatorGroupSave',
    method: 'post',
    data
  })
}
// 组成员等级列表
export function fetchLevelList(data) {
  return api({
    url: '/assign/getKpiLevel',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 组成员列表
export function fetchGroupList(data) {
  return api({
    url: '/assign/getGroup',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 核赔人列表
export function fetchPersonList(data) {
  return api({
    url: '/assign/getOperatorName',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 挂起页面查询列表
export function fetchPersonStatusList(data) {
  return api({
    url: '/assign/putQuery',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 挂起页面保存
export function savePersonStatusList(data) {
  return api({
    url: '/assign/putSave',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 挂起历史页面删除
export function putDelete(data) {
  return api({
    url: '/assign/putDelete',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 挂起历史页面查询
export function putHistory(data) {
  return api({
    url: '/assign/putHistory',
    method: 'post',
    data,
    otherConfigs: {
      NoPostSeqNo: true
    }
  })
}
// 执行试算接口
export function executeTrialCalculation(data) {
  return api({
    url: '/assign/executeTrialCalculation',
    method: 'post',
    data: {
      ...data,
      operator
    },
    otherConfigs: {
      skipErrorHandler: true
    }
  })
}
// 执行分配接口
export function executeAllocation(data) {
  return api.post('/assign/executeAllocation', { ...data, operator })
}
